/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tictactoe;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.border.*;
/**
 *
 * @author Kevin O
 */
public class NewGameFrame extends JInternalFrame implements ActionListener{
    
    private JPanel frame_panel;
    private JPanel button_panel;
    JComboBox multi_combo;
    JComboBox diff_combo;
    private JButton new_button;
    private JButton cancel_button;
    
    public NewGameFrame(){
        super("", false, true, false, false);
        this.setSize(300,250);
        
        frame_panel = new JPanel();
        
        //Sets the panel's border
        TitledBorder pantitle = BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
                "New Game");
        pantitle.setTitlePosition(TitledBorder.ABOVE_TOP);
        frame_panel.setBorder(pantitle);
        
        //Set up the combo boxes
        String[] multi_field = { "Single Player", "Multi Player" };
        multi_combo = new JComboBox(multi_field);
        multi_combo.setSelectedIndex(0);
        
        String[] diff_field = { "Easy", "Medium", "Hard" };
        diff_combo = new JComboBox(diff_field);
        diff_combo.setSelectedIndex(0);
        
        //Set up the buttons and panel for them
        button_panel = new JPanel();
        button_panel.setLayout(new GridLayout(2,1));
        new_button = new JButton("OK");
        new_button.addActionListener(this);
        cancel_button = new JButton("Cancel");
        cancel_button.addActionListener(this);
        button_panel.add(new_button);
        button_panel.add(cancel_button);
        
        //Set up the main panel
        frame_panel.setLayout(new BorderLayout());
        frame_panel.add(multi_combo, BorderLayout.NORTH);
        frame_panel.add(diff_combo, BorderLayout.CENTER);
        frame_panel.add(button_panel, BorderLayout.SOUTH);
        
        //Set up the content pane and add the frame panel
        JPanel contentpane = new JPanel(new BorderLayout());
        setContentPane(contentpane);
        getContentPane().add(frame_panel);
        
        //Sets appropriate frame size
        pack();
    }
    
    public void actionPerformed(ActionEvent e){
        System.out.println("CLICK");
    }
}
